<template>
  <div id="main" ref="appRef">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <div class="d-flex jc-center">
          <dv-decoration-10 class="dv-dec-10" />
          <div class="d-flex jc-center">
            <dv-decoration-8 class="dv-dec-8" :color="decorationColor" />
            <div class="title">
              <span class="title-text">德阳市智慧急救平台</span>
              <dv-decoration-6 class="dv-dec-6" :reverse="true" :color="['#50e3c2', '#67a1e5']" />
            </div>
            <dv-decoration-8 class="dv-dec-8" :reverse="true" :color="decorationColor" />
          </div>
          <dv-decoration-10 class="dv-dec-10-s" />
        </div>

        <div class="body-box">
          <div class="content-box">
            <div>
              <dv-border-box-12>
              <MainLeft />
              </dv-border-box-12>
            </div>
            <div>
              <MainCenter />
            </div>
            <div>
              <MainRight />
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 全局全屏弹窗 -->
    <global-fullscreen-popup />

  </div>
</template>
<script>
import drawMixin from "@/utils/drawMixin";
import {formatTime} from "@/utils";
import MainLeft from "@/views/main/mainLeft.vue";
import MainCenter from "@/views/main/mainCenter.vue";
import MainRight from "@/views/main/mainRight.vue";
import GlobalFullscreenPopup from "@/components/GlobalFullscreenPopup.vue";

export default {
  components: {GlobalFullscreenPopup, MainCenter, MainLeft, MainRight},
  mixins: [ drawMixin ],
  data() {
    return {
      timing: null,
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
      decorationColor: ['#568aea', '#000000']
    }
  },
  mounted() {
    this.timeFn()
    this.cancelLoading()
  },
  beforeDestroy () {
    clearInterval(this.timing)
  },
  methods: {
    timeFn() {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), 'HH: mm: ss')
        this.dateYear = formatTime(new Date(), 'yyyy-MM-dd')
        this.dateWeek = this.weekday[new Date().getDay()]
      }, 1000)
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false
      }, 500)
    }
  }
}
</script>
<style lang="scss" scoped>
@import '@/assets/scss/main.scss';
@import '@/assets/scss/element-screen.scss';
</style>
